Untitled2.ipynb
No Headings
The table of contents shows headings in notebooks and supported files.
- File
- Edit
- View
- Run
- Kernel
- Settings
- Help
Kernel status: Idle
[6]:
Selection deleted
import pandas as pd
data = {
'Player': ['Virat Kohli', 'Rohit Sharma', 'Jasprit Bumrah', 'KL Rahul', 'Ravindra Jadeja'],
'Matches': [250, 230, 180, 160, 200],
'Runs': [12000, 11000, 1000, 6500, 3000],
'Wickets': [4, 8, 350, 2, 200],
'Innings': [230, 220, 50, 150, 180],
'Not_Outs': [40, 35, 10, 20, 30] # Added Not Out data
}
# Creating DataFrame
df = pd.DataFrame(data)
print(df)
Player Matches Runs Wickets Innings Not_Outs 0 Virat Kohli 250 12000 4 230 40 1 Rohit Sharma 230 11000 8 220 35 2 Jasprit Bumrah 180 1000 350 50 10 3 KL Rahul 160 6500 2 150 20 4 Ravindra Jadeja 200 3000 200 180 30
[8]:
team_total_runs = df['Runs'].sum()
print("Team Total Runs:", team_total_runs)
Team Total Runs: 33500
[10]:
df['Batting_Average'] = df.apply(lambda row: row['Runs'] / (row['Innings'] - row['Not_Outs']) if (row['Innings'] - row['Not_Outs']) > 0 else 0, axis=1)
print(df)
Player Matches Runs Wickets Innings Not_Outs \ 0 Virat Kohli 250 12000 4 230 40 1 Rohit Sharma 230 11000 8 220 35 2 Jasprit Bumrah 180 1000 350 50 10 3 KL Rahul 160 6500 2 150 20 4 Ravindra Jadeja 200 3000 200 180 30 Batting_Average 0 63.157895 1 59.459459 2 25.000000 3 50.000000 4 20.000000
[12]:
df['Bowling_Strike_Rate'] = df.apply(lambda row: (row['Innings'] * 6) / row['Wickets'] if row['Wickets'] > 0 else 0, axis=1)
print(df)
Player Matches Runs Wickets Innings Not_Outs \ 0 Virat Kohli 250 12000 4 230 40 1 Rohit Sharma 230 11000 8 220 35 2 Jasprit Bumrah 180 1000 350 50 10 3 KL Rahul 160 6500 2 150 20 4 Ravindra Jadeja 200 3000 200 180 30 Batting_Average Bowling_Strike_Rate 0 63.157895 345.000000 1 59.459459 165.000000 2 25.000000 0.857143 3 50.000000 450.000000 4 20.000000 5.400000
[18]:
0
[20]:
2
[22]:
0
[24]:
2
Player Points 0 Virat Kohli 130 1 Rohit Sharma 128 2 Jasprit Bumrah 713 3 KL Rahul 71 4 Ravindra Jadeja 433
[ ]:
-
Variables
Callstack
Breakpoints
Source
9
1
Kernel Sources
Common Tools
No metadata.
Advanced Tools
No metadata.
Anaconda Assistant
AI-powered coding, insights and debugging in your notebooks.
To enable the following extensions, create an account or sign in.
- Anaconda Assistant4.1.0
- Coming soon!
- Data Catalogs
- Panel Deployments
- Sharing
Already have an account? Sign In
For more information, read our Anaconda Assistant documentation.
![Python [conda env:base] *](./cricket scoring analysis_files/logo-64x64.png)